home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / plug-ins / perl / pxgettext < prev    next >
Encoding:
Text File  |  2000-07-15  |  1.1 KB  |  51 lines

  1. #!/usr/bin/perl
  2.  
  3. # a lame attempt at xgettext for perl
  4. # line line numbers, yet
  5.  
  6. # 5.005_02 in particular seems to have a BIG BUG
  7. # resulting in an endless loop and a memory leak in the 
  8. # regex machinery :(
  9. exit 0 unless ( $] >= 5.005_03 || $] <= 5.005 );
  10.  
  11. undef $/;
  12.  
  13. print <<'EOF';
  14. # SOME DESCRIPTIVE TITLE.
  15. # Copyright (C) YEAR Free Software Foundation, Inc.
  16. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  17. #
  18. #, fuzzy
  19. msgid ""
  20. msgstr ""
  21. "Project-Id-Version: gimp-perl 1.14\n"
  22. "POT-Creation-Date: 1999-09-12 17:58+0200\n"
  23. "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  24. "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  25. "Language-Team: LANGUAGE <LL@li.org>\n"
  26. "MIME-Version: 1.0\n"
  27. "Content-Type: text/plain; charset=CHARSET\n"
  28. "Content-Transfer-Encoding: ENCODING\n"
  29. EOF
  30.  
  31. while(<>) {
  32.     while (/(?:N|_)_\(?"((?:[^"\\]+|\\.)*)"\)?/sg) {
  33.        my $s = $1;
  34.        my $e = "\n";
  35.        if ($s =~ /\n/) {
  36.           $e .= "msgid \"\"\n";
  37.           for (split /\n/, $s) {
  38.              $e .= "\"$_\\n\"\n";
  39.           }
  40.        } else {
  41.           $e .= "msgid \"$s\"\n";
  42.        }
  43.        $e .= "msgstr \"\"\n";
  44.        push @{$entry{$e}}, $fileposition;
  45.     }
  46. }
  47.  
  48. print keys %entry;
  49.  
  50.  
  51.